home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 1 / Atari Mega Archive - Volume 1.iso / lists / mint / l_1199 / 1638 < prev    next >
Encoding:
Internet Message Format  |  1994-08-27  |  1.4 KB

  1. Subject: bug in mintlib44's access() function
  2. Date: Sun, 19 Jun 94 13:21:50 +0200
  3. From: Torsten Scherer <itschere@techfak.uni-bielefeld.de>
  4.  
  5.  Hi!
  6.  
  7.  It's probably not ok that the access function from mintlib PL44 uses the
  8. `real' user id's to determine access rights, and not the `effective' ones.
  9. If you apply this patch, things look a bit more logical to me... :)
  10.  
  11. ciao,
  12. TeSche
  13. -- 
  14. Torsten Scherer (TeSche, Schiller...)
  15. Faculty of Technology, University of Bielefeld, Germany, Europe, Earth...
  16. | Use any of "finger itschere@129.70.131.2-15" for adresses and more.|
  17. | Last updated: 14. April 1994.|
  18.  
  19.  
  20. --- access.c.origSun Jun 19 13:14:36 1994
  21. +++ access.cSun Jun 19 13:15:48 1994
  22. @@ -13,6 +13,7 @@
  23.  const char *path;
  24.  int mode;
  25.  {
  26. +int euid;
  27.  struct stat sb;
  28.  
  29.  if (stat(path, &sb) < 0)
  30. @@ -20,19 +21,19 @@
  31.  if (mode == F_OK)
  32.  return 0;/* existence test succeeded */
  33.  
  34. -if (getuid() == 0) return 0; /* super user can access anything */
  35. +if ((euid = geteuid()) == 0) return 0; /* super user can access anything */
  36.  
  37.  /* somewhat crufty code -- relies on R_OK, etc. matching the bits in the
  38.     file mode, but what the heck, we can do this
  39.   */
  40. -if (__mint < 9 || ( getuid() == sb.st_uid ) ) {
  41. +if (__mint < 9 || ( euid == sb.st_uid ) ) {
  42.  if ( ((sb.st_mode >> 6) & mode) == mode )
  43.  return 0;
  44.  else
  45.  goto accdn;
  46.  }
  47.  
  48. -if ( getgid() == sb.st_gid ) {
  49. +if ( getegid() == sb.st_gid ) {
  50.  if ( ((sb.st_mode >> 3) & mode) == mode )
  51.  return 0;
  52.  else
  53.